﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="d" uri="/WEB-INF/resource.tld" %>

<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">

    <div class="panel panel-default x-panel x-panel-layout">

      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/ecommerce">电商管理</a></li>
          <li class="active">课程管理</li>
          <li class="no-before pull-right" style="min-width: 65px;">
            <a onclick="window.history.back();"><i class="glyphicon glyphicon-arrow-left"></i>&nbsp;&nbsp;返回</a>
          </li>
        </ol>
      </div>

      <div class="panel-body">

        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>

        <div class="col-xs-10 x-panel-layout-right">

          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire" title="月卡季卡课程"></i>&nbsp;&nbsp;<span>课程管理&nbsp;-&nbsp;会籍卡详情</span></h2>
            </div>
          </div>
          
          <div class="x-breadcrumb-wrapper top-margin-20" style="position: relative;">
              <ul class="nav nav-pills x-breadcrumb-nav">
                <li role="presentation" class="active">
                  <a href="${ctx.host}/year-rounds/${courseRound.id}?status=${courseRound.courseStatus.alias}" role="tab" >基本信息</a>
               </li>
        	   <c:if test="${not empty courseRound.fitnessGroup}">
                 <li class="pull-left"><a href="${ctx.host}/year-rounds/${courseRound.id}/batch-coursewares/1?type=weekly&status=${courseRound.courseStatus.alias}">家庭作业</a></li>
                 <li class="pull-left"><a href="${ctx.host}/year-rounds/${courseRound.id}/batch-coursewares/1?type=course&status=${courseRound.courseStatus.alias}&day=1">上课课件</a></li>
               </c:if>
               <c:if test="${!courseRound.courseStatus.prepare and status!='prepare'}">
                 <li role="presentation" >
                   <a href="${ctx.host}/year-rounds/${courseRound.id}/physical-data?status=${courseRound.courseStatus.alias}" role="tab" >身体数据</a>
                 </li>
               </c:if>
              </ul>
            </div>
          
          <div class="clearfix">
          
          <div class="form-horizontal x-form-horizontal" style="width: 45%; float: left">
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">课程名称：</label>
              <div class="col-xs-6">
                <p class="form-control-static">${courseRound.course.name}</p>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">课程周期：</label>
              <div class="col-xs-6">
                <p class="form-control-static">${courseRound.course.weeks}周${courseRound.course.hours}课时</p>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">学员名称：</label>
              <div class="col-xs-6">
                <p class="form-control-static">${courseRound.student.name}</p>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">学员手机：</label>
              <div class="col-xs-6">
                <p class="form-control-static">${courseRound.student.mobile}</p>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">学员标签：</label>
              <div class="col-xs-6">
                <p class="form-control-static">新学员/基础组学员/年卡会员</p>
              </div>
            </div>
            
          </div>
          
          <div class="pull-right" style="width: 55%;">
            <div class="form-horizontal clearfix">
              <div class="form-group" style="margin-bottom: 0px;">
                <label class="form-control-static col-xs-2 pull-left">上课次数：</label>
                <div class="col-xs-1">
                  <p class="form-control-static">${courseRound.schedules.size()}</p>
                </div>
                
                <div class="form-control-static col-xs-2 pull-right">
                  <%-- <a href="${ctx.host}/year-rounds/${courseRound.id}/schedules/create" data-toggle="modal" data-target="#schedule-create" dataclass="hover-no-text-decoration" title="增加课程">增加课程</a> --%>
                </div>
              </div>
            </div>
            <table class="table table-striped table-hover x-table schedule-table" data-toggle="table" style="margin-top: 0px;">
              <thead>
                <tr>
                  <th>日期</th>
                  <th>时间段</th>
                  <th>状态</th>
                  <th>教练</th>
                  <th class="text-center">操作</th>
                </tr>
              </thead>
              <tbody>
                <c:forEach var="schedule" items="${courseRound.schedules}">
                  <tr>
                    <td><fmt:formatDate value="${schedule.occurDate}" pattern="yyyy-MM-dd"/></td>
                    <td>${schedule.occurHour}</td>
                    <td>${schedule.scheduleStatus.description}</td>
                    <td>${schedule.coach.name}</td>
                    <td class="text-center">
                      <c:if test="${not currentPrincipal.coursewareManager and not currentPrincipal.coursewareMonitor}">
                        <c:choose>
                          <c:when test="${((currentPrincipal.root or currentPrincipal.admin) and schedule.scheduleStatus.expiry) or (courseRound.courseStatus.hold and schedule.scheduleStatus.ready)}">
                            <a href="${ctx.host}/year-rounds/${courseRound.id}/schedules/${schedule.id}/cancel" data-toggle="modal" data-target="#schedule-cancel">取消</a>&nbsp;&nbsp;
                          </c:when>
                          <c:when test="${courseRound.courseStatus.ready and schedule.scheduleStatus.ready}">
                            <%-- <c:if test="${currentPrincipal.admin || currentPrincipal.root}"> --%>
                              <%-- <a href="${ctx.host}/year-rounds/${courseRound.id}/schedules/${schedule.id}/edit" data-toggle="modal" data-target="#edit-schedule">修改课程</a> --%>
                            <%-- </c:if> --%>
                          </c:when>
                          <c:when test="${courseRound.courseStatus.ready and schedule.scheduleStatus.expiry and (currentPrincipal.admin or currentPrincipal.root or currentPrincipal.specialSite)}">
                            <a href="${ctx.host}/expiry-schedules/${schedule.id}/finished" class="hover-no-text-decoration" data-toggle="modal" data-target="#expiry-schedule-finish" title="已上课">已上课</a>
                          </c:when>
                          <c:otherwise>
                            -
                          </c:otherwise>
                        </c:choose>
                      </c:if>
                    </td>
                  </tr>
                </c:forEach>
              </tbody>
            </table>
          </div>
          </div>
          
        </div>
          
        </div>

      </div>

    </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/course/year-round-view.js">
    <script type="text/javascript">
      require(['page/course/year-round-view'], function(page) {
        page.init()
      })
    </script>
  </d:resource>
  
</body>

</html>
